package com.phoebe.auth.service.impl;

import com.phoebe.auth.model.AuthAccessKey;
import com.phoebe.auth.model.AuthApp;
import com.phoebe.auth.repository.AuthAccessKeyRepository;
import com.phoebe.auth.repository.AuthAppRepository;
import com.phoebe.auth.service.AuthAccessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author: zhaojd1604@gmail.com
 * @date: 2019-01-04 15:04
 * @description:
 * @since: V0.0.1
 */
@Service
public class AuthAccessServiceImpl implements AuthAccessService {

    @Autowired
    private AuthAppRepository authAppRepository;
    @Autowired
    private AuthAccessKeyRepository authAccessKeyRepository;

    @Override
    public AuthApp findByKey(String key) {
        return authAppRepository.findByKey(key);
    }

    @Override
    public AuthAccessKey findByAppIdAndAccessKeyId(long appId, String accessKeyId) {
        return authAccessKeyRepository.findByAppIdAndAccessKeyId(appId, accessKeyId);
    }
}